﻿@model IEnumerable<tutors_clus.Models.comment>
@{
    ViewBag.Title = "Comment_Detail";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
        @foreach (var item in Model)
            {
                <div class="postbodytop">
                    <h2>@item.title_com</h2>

                    <div class="infoAuthor"><span>
                        @{
                            if(@item.isrepply == true)
                            {
                                if (@item.course.teacher.id_tea == WebSecurity.CurrentUserId)
                                {
                                    <i>Bạn</i>
                                }
                                else
                                {
                                    @item.course.teacher.fullname_tea
                                }
                                
                            }else
                            {
                                @item.student.fullname_stu
                                
                            }
                        }
                 </span> <i>đăng vào @item.createdate</i></div>
                </div>
                <div class="postcontent">@MvcHtmlString.Create(item.content_com)</div>
            }
        
        <div class="repost">
            
                    <div class="count_com">
                        <h2>@ViewBag.count bình luận</h2>
                    </div>
                    <hr />
                    @foreach (var item2 in ViewBag.detail_comment)
                    {
                        <div class="repostbody">
                        <div class="infoAuthor"><span>
                           @{
                            if(@item2.isrepply == true)
                            {
                                if (@item2.course.teacher.id_tea == WebSecurity.CurrentUserId)
                                {
                                    <i>Bạn</i>
                                }
                                else
                                {
                                    @item2.course.teacher.fullname_tea
                                }
                                
                            }else
                            {
                                @item2.student.fullname_stu
                                
                            }
                        }
                        </span> đã đăng vào @item2.createdate</div>
                    
                        <div class="postcontent">@MvcHtmlString.Create(item2.content_com)</div>
                    </div>  
                    }
                
                
        </div>
            
        <div class="repost">
            <div class="count_com">
                <p>Bình luận mới</p>
            </div>
            <hr />
            <div class="repostbody">
                @using(Html.BeginForm("Add_detail_com","Teacher",new { id_cou=Model.Select(m=>m.id_cou).FirstOrDefault(), id_com=Model.Select(m=>m.id_com).FirstOrDefault()}))
                    {
                        <textarea id="contentCom" name="contentCom" placeholder="Bình luận" ></textarea>
                        <input type="submit" name="name" value="Bình luận" />
                    }
            </div>
        </div>
